FROM centos:php72-deploy

WORKDIR /www

COPY ./source ./source

WORKDIR /www/source
RUN /usr/local/webserver/php7.2.6/bin/phpize
RUN ./configure --with-php-config=/usr/local/webserver/php7.2.6/bin/php-config
RUN make
RUN make install 

WORKDIR /www


COPY ./include ./include
COPY ./pushgateway.ini ./pushgateway.ini

COPY ./vendor ./vendor
COPY ./composer.json ./composer.json
COPY ./composer.lock ./composer.lock
COPY ./helloworld.php ./helloworld.php
COPY ./curl.php ./curl.php
COPY ./mysqli_query.php ./mysqli_query.php
COPY ./mysqli_stmt.php ./mysqli_stmt.php
COPY ./pdo.php ./pdo.php
COPY ./pdo_insert.php ./pdo_insert.php
COPY ./pdo_query.php ./pdo_query.php
COPY ./pdo_stmt.php ./pdo_stmt.php
COPY ./phpredis.php ./phpredis.php
COPY ./predis.php ./predis.php
COPY ./index.html ./index.html
COPY ./run.sh ./run.sh

RUN cat ./pushgateway.ini >> /usr/local/webserver/php7.2.6/etc/php.ini
RUN sed -i 's/pm.max_children = 256/pm.max_children = 2/g' /usr/local/webserver/php7.2.6/etc/php-fpm.d/www.conf
RUN sed -i 's/listen = 127.0.0.1:9072/listen = 127.0.0.1:9000/g' /usr/local/webserver/php7.2.6/etc/php-fpm.d/www.conf

RUN chmod +x ./run.sh

ENTRYPOINT ["./run.sh"]